package Demo;

import java.util.Objects;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-09-04
 * Time: 10:37
 */
public class Course {
    //属性
    private int courseCode;//课程代码
    private String name;//课程名称
    private String category;//课程类别
    private String teacher;//任课老师
    private int credit;//学分

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Course course = (Course) o;
        return courseCode == course.courseCode && credit == course.credit && Objects.equals(name, course.name) && Objects.equals(category, course.category) && Objects.equals(teacher, course.teacher);
    }

    @Override
    public int hashCode() {
        return Objects.hash(courseCode, name, category, teacher, credit);
    }

    @Override
    public String toString() {
        return "Course{" +
                "courseCode=" + courseCode +
                ", name='" + name + '\'' +
                ", category='" + category + '\'' +
                ", teacher='" + teacher + '\'' +
                ", credit=" + credit +
                '}';
    }

    public int getCourseCode() {
        return courseCode;
    }

    public void setCourseCode(int courseCode) {
        this.courseCode = courseCode;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getTeacher() {
        return teacher;
    }

    public void setTeacher(String teacher) {
        this.teacher = teacher;
    }

    public int getCredit() {
        return credit;
    }

    public void setCredit(int credit) {
        this.credit = credit;
    }
}
